package com.reader_;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * @author Vhong
 * @version 1.0
 */
public class BufferedReader_ {
    public static void main(String[] args) throws IOException {

        String filePath = "e:\\story.txt";
        //创建BufferReader
        BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
        //读取
        String line ;//按行读取，效率高

        //1.bufferedReader.readLine(）是按行读取文件
        //2.当返回null时，表示文件读取完毕
        while ((line = bufferedReader.readLine()) != null){
            System.out.println(line);
        }
        //关闭流，只需要关闭BufferedReader，因为底层会自动的去关闭 节点流
        //FileReader_
        bufferedReader.close();
    }
}
